package io.springboot.jpa.examples.springbootjpaexamples.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Date;

/**
 * @author yzc
 * @description
 * @date 2018/9/9
 */
@MappedSuperclass
@JsonIgnoreProperties(value = {"handler", "hibernateLazyInitializer"})
public class BaseBean {
    private long id;
    private Timestamp createTime = new Timestamp(new Date().getTime());
    private Timestamp lastModifiedTime = new Timestamp(new Date().getTime());

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Column(name = "create_time", columnDefinition = "timestamp")
    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    @Column(name = "last_modified_time", columnDefinition = "timestamp")
    public Timestamp getLastModifiedTime() {
        return lastModifiedTime;
    }

    public void setLastModifiedTime(Timestamp lastModifiedTime) {
        this.lastModifiedTime = lastModifiedTime;
    }

}
